UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dNMW91sGWns8aWzZAHC9pIynHw57DfWoh8NOXKFwIJI='
WHERE
key_id = '2e565139c1f10b8f68291f227858099b0a0ea5c96db5d89fdba5ac4c4130dcb0'
AND (
token = 'dNMW91sGWns8aWzZAHC9pIynHw57DfWoh8NOXKFwIJI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)