UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EakOiz1tUabsySFOsm9YOvquMUQ1fYeCIOwumyfA3OM=' 
WHERE 
  key_id = '5ed4b80c30861f7b848d9ae82d50508a6eec531a1f60d771ec5798e3ddf6eddc' 
  AND (
    token = 'EakOiz1tUabsySFOsm9YOvquMUQ1fYeCIOwumyfA3OM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028