UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SxIvPgOXFnCZRirS6bBbGyixojJ2B9znKhUx1mFbod4='
WHERE
key_id = '5d0bc34e81075c1392fb12afa6290e8a636a1261c2794404ba136d786492ebee'
AND (
token = 'SxIvPgOXFnCZRirS6bBbGyixojJ2B9znKhUx1mFbod4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)