UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pigJ+IqesIdAQ0xWpKfVX4+GwrfF+zYPKF9ZEMBhW3g=' 
WHERE 
  key_id = '850f0b44bffab28d983ec66fd50efba9ede305aeba93be92e035b1f172c87413' 
  AND (
    token = 'pigJ+IqesIdAQ0xWpKfVX4+GwrfF+zYPKF9ZEMBhW3g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032