UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BwtXr4GkLvZJYQSy+Z5eoJf/KZJqlTmGVqRWb12s1+Y='
WHERE
key_id = 'edf41f79b8bfda70a91f66f0b35733849be93aa11978a947512da395d0a421d9'
AND (
token = 'BwtXr4GkLvZJYQSy+Z5eoJf/KZJqlTmGVqRWb12s1+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)