UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/mNX1vx9+N9ENP0TOo+foZRTGa5rE8+qTLEFAvfSvcU='
WHERE
key_id = 'ba165a8e8d5a2f8bce5224828c40b9070d0c34df14abb9949e9eec4ac24495d3'
AND (
token = '/mNX1vx9+N9ENP0TOo+foZRTGa5rE8+qTLEFAvfSvcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)