UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cJ2aEy9RrsA7qaz2vmDLNKm87sPjxAzDz03h+p+1ATo=' 
WHERE 
  key_id = '284d98edb2b5b0a26e7b1407acd4f6ce68bd6e1b519a6aaa5fbe637e22455b39' 
  AND (
    token = 'cJ2aEy9RrsA7qaz2vmDLNKm87sPjxAzDz03h+p+1ATo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037