UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OJW9245R4DHB74zDalwFaUuNcp29jBmu6vVnhrteYgQ='
WHERE
key_id = '283e565fcd8b15b0a664676e8535dda102005af0a9287c48e6337ccf88f829ce'
AND (
token = 'OJW9245R4DHB74zDalwFaUuNcp29jBmu6vVnhrteYgQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)