UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AaDP77OGHCM/Y6b+4bhvQYVter4bOCkf2S7UsDlFFLA='
WHERE
key_id = '13902fb7fa1748cd6bedefdd4b3653ac7640add9764a8bec290c4812785844bb'
AND (
token = 'AaDP77OGHCM/Y6b+4bhvQYVter4bOCkf2S7UsDlFFLA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)