UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ceXtIGVokb3irx60+d60DNmKPRjV02+V8vbi6LYASZc=' 
WHERE 
  key_id = 'bf468f268f113c41ce609c5679b9a2489fd495cfdbfcc0ff228a39eff98e8840' 
  AND (
    token = 'ceXtIGVokb3irx60+d60DNmKPRjV02+V8vbi6LYASZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040