UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a5+bwOUJIBuET/MUr/2uRpov60dzY5K0t2q9DiCrAh0='
WHERE
key_id = '8397fd83e12a5d7ff9ff4465d8d579f93e8dfe0adefbdd25791f500b53d191c5'
AND (
token = 'a5+bwOUJIBuET/MUr/2uRpov60dzY5K0t2q9DiCrAh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)