UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qfup8qiLWp2jzW58rCfnhf/m6gMD+PFjcKXVX1riEZo='
WHERE
key_id = '5b90caad1318369204f94d2e94cd04a968e7d7b7e9f9c21873b8c26be25bc786'
AND (
token = 'Qfup8qiLWp2jzW58rCfnhf/m6gMD+PFjcKXVX1riEZo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)