UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZkS4l5aBFXBK5RZeZwsl181MoSepUJV564OnMaRII+4=' 
WHERE 
  key_id = '75fc6e9bc31d77c36faeb3133111e05aefdce844d901dc279ffa6bece81301a2' 
  AND (
    token = 'ZkS4l5aBFXBK5RZeZwsl181MoSepUJV564OnMaRII+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026