UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tQ8DJzM0U/5hDcUoVNUUQm1c8foT3i1Xdeqn0XPSMAA='
WHERE
key_id = '1f9cd6453a1ef3487ad4fa56a4e89d86856e7b657868166c2617c7e7ab5896f0'
AND (
token = 'tQ8DJzM0U/5hDcUoVNUUQm1c8foT3i1Xdeqn0XPSMAA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)