UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wfs7S1GVy0ES8YdW1knORMvtbiy0TOGNpLVT9FVv+XQ=' 
WHERE 
  key_id = 'd045166b89184d85f4ddc4d8a1e9f1cfc422986e06814c4d5cee31a0248ae891' 
  AND (
    token = 'Wfs7S1GVy0ES8YdW1knORMvtbiy0TOGNpLVT9FVv+XQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039