UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'amT8eH0fHfiKVEm55hLtS6d75Err3vzxksswt+iFaao='
WHERE
key_id = '38c6a38e98c5c1651effd38289db59cca3bbe1c2cdfb6ef806aba6e8e159de71'
AND (
token = 'amT8eH0fHfiKVEm55hLtS6d75Err3vzxksswt+iFaao='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)