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

Query time 0.00028