UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uKT6ZhmTh4bOY3ONXnsZZbkCMdG1DbhqHqNqCyu2SR4=' 
WHERE 
  key_id = 'ba96a5f7b05cd9298f1d091830dc9d51632b4a52a538151c44bb1eca5147841a' 
  AND (
    token = 'uKT6ZhmTh4bOY3ONXnsZZbkCMdG1DbhqHqNqCyu2SR4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032