UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M96optkvUkJwjczK5aFD849C1mPvGEtBAfhX31sF+B0=' 
WHERE 
  key_id = 'e82985b9b0675a2447ae4d4d02f7da74acd6ecdf234604251f65eb390f8d5dfa' 
  AND (
    token = 'M96optkvUkJwjczK5aFD849C1mPvGEtBAfhX31sF+B0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041