UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mc5nQC4PTKlUjsGJMym4MrE1slr5eotvwLjjXpeITdU=' 
WHERE 
  key_id = '34ab4505435b06abf7fe9c14ddb3a22193a1fa376010e27767e70c09fc398489' 
  AND (
    token = 'mc5nQC4PTKlUjsGJMym4MrE1slr5eotvwLjjXpeITdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036