UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N6Rwqju9zA04r6cmMYyrLC4EleJf27+L7gbrIuAAtPo=' 
WHERE 
  key_id = '288d7eedc2a70e30c0e62dcc2b9ac71c0cfac3746a3d6839fd5a55c77966522b' 
  AND (
    token = 'N6Rwqju9zA04r6cmMYyrLC4EleJf27+L7gbrIuAAtPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033