UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FNH+G2oYfrHKvXMFrZrKMxoiMJeI1CbF0VEYGgzv24c=' 
WHERE 
  key_id = '7de37c56bbead5ea7b60f87e34e20c73296a9032029828abe98ed6cb2121e52c' 
  AND (
    token = 'FNH+G2oYfrHKvXMFrZrKMxoiMJeI1CbF0VEYGgzv24c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030