UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nBGe2r71PWoYIacm3wRcjdEhAP6iEV/UnXbp8BuvcE0='
WHERE
key_id = 'd5509f0fe20f822e233a97324106dd1513b11811233fe7c85232540983aee83f'
AND (
token = 'nBGe2r71PWoYIacm3wRcjdEhAP6iEV/UnXbp8BuvcE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)