UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sDuOw4xFY5xk9u35gbsdG4e67794JYA5f2CUa4Ph4ks=' 
WHERE 
  key_id = '2c36ed12a4c7433c1e3cfd1c42dfe6f951f40d0fd68b3600da6b4c08fcccb28d' 
  AND (
    token = 'sDuOw4xFY5xk9u35gbsdG4e67794JYA5f2CUa4Ph4ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018