UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZX2m3SpNMc8jh58bHiTDgG2KW7drRm9xeynmemCFNC4=' 
WHERE 
  key_id = '76648aff5de82b76f048c7cf49e93b439d19c7aa5184bd561953b3638c6bf84a' 
  AND (
    token = 'ZX2m3SpNMc8jh58bHiTDgG2KW7drRm9xeynmemCFNC4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030