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