UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gJ9CpKXMNhvB8JBfA9ttxb1j12G/jocN6yRYFSUUo3c='
WHERE
key_id = 'aa3ae3df9be9e20bc4e092c4929388047e1f603f97e2c01398645434348c2e76'
AND (
token = 'gJ9CpKXMNhvB8JBfA9ttxb1j12G/jocN6yRYFSUUo3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)