UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gMDlVmrhh+yzP/m9Ag4leeycfNsbQFFeorWriL4wNno=' 
WHERE 
  key_id = '1554dd76af995556a2741d6a0cd8e5a1e1eb3a29c3afc56b6178bfe1277db171' 
  AND (
    token = 'gMDlVmrhh+yzP/m9Ag4leeycfNsbQFFeorWriL4wNno=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040