UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'emMX2x/AV+0PCYBl65QeCL0ald+5RF8HVBloesIiycI=' 
WHERE 
  key_id = '66a17c2ccdac1c605fb541c3fffec5ce0eb68c5e52a14dd28f6085c90cc3d381' 
  AND (
    token = 'emMX2x/AV+0PCYBl65QeCL0ald+5RF8HVBloesIiycI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00115