UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CQjbtqgwSnnKWM8cwkx8lJUHqHNTOkwi3u8D8dWToLM='
WHERE
key_id = '5431752b5901db6b5666f0ad18a0df24a5902d331c79a8935f9abb0871b210e0'
AND (
token = 'CQjbtqgwSnnKWM8cwkx8lJUHqHNTOkwi3u8D8dWToLM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)