UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X5hXO7DjKtPxie0eZ0oqNM3rbMVEBPe2HQSHjBk368o='
WHERE
key_id = '52cef35ed72b67485d5b46b77a95b11d6e20f8cd4abf13a626daeeaec8144ec2'
AND (
token = 'X5hXO7DjKtPxie0eZ0oqNM3rbMVEBPe2HQSHjBk368o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)