UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sX7Acl3VEg/F7fZy7DsiC32akQtbpT42SzzGpa7U9gA=' 
WHERE 
  key_id = '4e059e0991666a97d4d3a62187b2444235587ae488491a3a38fbd2310fbd4642' 
  AND (
    token = 'sX7Acl3VEg/F7fZy7DsiC32akQtbpT42SzzGpa7U9gA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046