UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WsVbRcUH3cXl9yagH03nPT5CoPOFMJ6w/UMY/MBOyx8='
WHERE
key_id = 'a5e7225eff79da978189b7fa10d64e638de9aa2696fdd6179610252407b2c1c5'
AND (
token = 'WsVbRcUH3cXl9yagH03nPT5CoPOFMJ6w/UMY/MBOyx8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)