UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tXZhiG0jY4pt5e1uT4aQhOHX7h8GBTGC+g0RQBgkze8='
WHERE
key_id = '51116d37ef50158d2071bb73fbf1bea53c84430de6791ca19195797bc1eb1ae6'
AND (
token = 'tXZhiG0jY4pt5e1uT4aQhOHX7h8GBTGC+g0RQBgkze8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)