UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZDLvL5A7gbqi+eXmpYmVkseI9Ki9mNI5bjqQN2DkJ0M=' 
WHERE 
  key_id = '586c520cced681e90e202cebbc4be7c7043bf83c2ef4a370ede6e0b56e60b474' 
  AND (
    token = 'ZDLvL5A7gbqi+eXmpYmVkseI9Ki9mNI5bjqQN2DkJ0M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033