UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NecgiZTka/3ekKeBW0ztFOLC/3ju4/LtZFP4nq84VN8=' 
WHERE 
  key_id = 'c984a2f0de25646ed197237a53a98a7615b9e711fa1e95f134119a0e488b81e3' 
  AND (
    token = 'NecgiZTka/3ekKeBW0ztFOLC/3ju4/LtZFP4nq84VN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022