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

Query time 0.00023