UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PTEWNke5WZxK1swOoFXSG4qP40HNkygCu8JmzgtbtGQ=' 
WHERE 
  key_id = '765da7fe80c69dd4678750183fd363a71e24f86bf66ecaf0b1c477695d983521' 
  AND (
    token = 'PTEWNke5WZxK1swOoFXSG4qP40HNkygCu8JmzgtbtGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026