UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oqT29YBPjHzOYjF3iTpSfE8Ermp1D1ujbgatkm4OGgM='
WHERE
key_id = '0adef039e357a5dacf6c3245c77d30e86d6f01d10c92251069871a1f83e97486'
AND (
token = 'oqT29YBPjHzOYjF3iTpSfE8Ermp1D1ujbgatkm4OGgM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)