UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gF9xn113y/EzoC3d0vAP0Hf39itfZQ5ABZCqJrtVwFk=' 
WHERE 
  key_id = '1969fe9a589aee42933f19b0572aafb17b59e24233a74aad6cc9e0c1f4cedcc9' 
  AND (
    token = 'gF9xn113y/EzoC3d0vAP0Hf39itfZQ5ABZCqJrtVwFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032