UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BLtYbP/xyKhWt1BgHH44Gutpxf0lftDRBaSE0zJ+kPU=' 
WHERE 
  key_id = '34c252a0223a7a01fa5eb043fce29f73155703ceaf8477916cbabce6025e1e04' 
  AND (
    token = 'BLtYbP/xyKhWt1BgHH44Gutpxf0lftDRBaSE0zJ+kPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028