UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+4JT2Hs5JYGl8qddnAjnZUQSMXUt83OrWs1Yp6BxXXw='
WHERE
key_id = 'fe48f2f6566647a72a377a2779139f55f86d3d1713d4898f71aa8a61124eedbb'
AND (
token = '+4JT2Hs5JYGl8qddnAjnZUQSMXUt83OrWs1Yp6BxXXw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)