UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8KK4lluq6V2/K4jAqHLNFyy7pjLnTZDs2+YllJTa14g='
WHERE
key_id = 'f8512dd16f686b75cfa8f5bbfdbf61cd4434f05bdf05175f5328c998853d90c8'
AND (
token = '8KK4lluq6V2/K4jAqHLNFyy7pjLnTZDs2+YllJTa14g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)