UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YjqfEx97TytAihxHgJKzLpn329IFBtgW2Y7m0L9p71k=' 
WHERE 
  key_id = '9696b8dd1ac512bfaef4ad800752aaf62efd0d785a95483001dff9d08b27536f' 
  AND (
    token = 'YjqfEx97TytAihxHgJKzLpn329IFBtgW2Y7m0L9p71k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047