UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TANoIX25pn9TyorWP3cUaHM2qLEIGEnQQoolmXboZgY=' 
WHERE 
  key_id = '01ffd92921911ce54a6326c3dee07058fdc75d3f0c13b43df6621d22d758ab49' 
  AND (
    token = 'TANoIX25pn9TyorWP3cUaHM2qLEIGEnQQoolmXboZgY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039