UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9fLCR1yU2LJpnMAf5oDzF19Foqgyh8+j+a0oQAa04vs=' 
WHERE 
  key_id = '3150995e83e2d47e7bd9fc436c6a8bce91a49fd90410f913697901c6373a215b' 
  AND (
    token = '9fLCR1yU2LJpnMAf5oDzF19Foqgyh8+j+a0oQAa04vs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023