UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's5gQvMsAsIr5rucb+GiBprgswoDutEvprlPMxzRpXBc=' 
WHERE 
  key_id = '0f498159b32e8566e96add8d5cde41b36a9156315dee0221d49bf0340644e090' 
  AND (
    token = 's5gQvMsAsIr5rucb+GiBprgswoDutEvprlPMxzRpXBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017