UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CHrDnbD4IghpdPZ0RXNZCKWUFj+D5bdHKavRHPF1HSA=' 
WHERE 
  key_id = 'b3fba216b105ecefd9609bd8e12b8b1ac5289d131da129dde55db2408929752f' 
  AND (
    token = 'CHrDnbD4IghpdPZ0RXNZCKWUFj+D5bdHKavRHPF1HSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032