UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y2jNBIQ+FEKrGXANg+S6UxbZMUSDvWJo9j8s5vBPxLM=' 
WHERE 
  key_id = '380daeb369b31cafe5174481faf00bc0378ed187e0e9d16d673de979f828d738' 
  AND (
    token = 'y2jNBIQ+FEKrGXANg+S6UxbZMUSDvWJo9j8s5vBPxLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022