UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PGOKOyzjuSiA3UIUzVatBcStPs0UMy7dIprdlCZheyI=' 
WHERE 
  key_id = '15a4f705d518cf23d6f3f6e60fb7b8768dd068de106fee08b0e596674f4eb1b8' 
  AND (
    token = 'PGOKOyzjuSiA3UIUzVatBcStPs0UMy7dIprdlCZheyI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043