UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xUap1vrEAypraE8GTQKbYUNYxG/IUyquHXMYPgyERjU=' 
WHERE 
  key_id = 'e249b371fe5f2698c47c4706f7e6307c4e93cdab81e3ccf4ab20e7a52a107654' 
  AND (
    token = 'xUap1vrEAypraE8GTQKbYUNYxG/IUyquHXMYPgyERjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040