UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X6mvPEmVz53d+0/YQ7awqF5SWKNdRAE/4JWzTAYL2Qc=' 
WHERE 
  key_id = 'a270a475b9c9903706b0317b1b1d3e67f008e93798374a0335210f25bc22a005' 
  AND (
    token = 'X6mvPEmVz53d+0/YQ7awqF5SWKNdRAE/4JWzTAYL2Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030